const $api = require('./../../utils/request').API;
Page({
  data: {
    nvaHeight: 0,
    userInfo: {},
    info: {},
    showBtn:true
  },
  no() {
    wx.showToast({
      title: '暂未开放',
      icon: 'error'
    })
  },
  goswitchTab(event) {
    wx.switchTab({
      url: event.currentTarget.dataset.url,
    })
  },
  login() {
    wx.navigateTo({
      url: '../login/login',
    })
  },
  goUrl(event) {
    wx.navigateTo({
      url: event.currentTarget.dataset.url,
    })
  },

  onLoad: function (options) {
    var that = this;
    wx.getSystemInfo({
      success: (result) => {
        this.setData({ nvaHeight: result.statusBarHeight + 46 })
      },
    });


  },

  getJiShi() {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  getMenberInfo() {
    $api.getMemberInfo({ openId: wx.getStorageSync('openid') }).then(result => {
      if (result.data != null) {
        
        this.setData({
          info: result.data,
          showBtn:false
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getMenberInfo();
    if (wx.getStorageSync('userInfo') != '') {
      this.setData({
        userInfo: wx.getStorageSync('userInfo')
      })
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})